package cn.edu.hunau.java.week02.day03;

import cn.edu.hunau.java.week02.day02.afternoon.Point;

import java.util.Objects;

public class Shape {
    private Point position;

    public Shape() {
    }

    public Shape(Point position) {
        this.position = position;
    }

    @Override
    public String toString() {
        return "Shape{" +
                "position=" + position +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Shape shape = (Shape) o;
        return Objects.equals(position, shape.position);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(position);
    }

    public Shape(int x, int y) {
        this(new Point(x,y));
    }

    public double area(){
        return -1;
    }

    public boolean container(Point p){
        return false;
    }

    public boolean container(int x,int y){
        return this.container(new Point(x,y));
    }

    public Point getPosition() {
        return position;
    }

    public void setPosition(Point position) {
        this.position = position;
    }
}
